<?php

class Jf_Module_Plugin_Bootstrap extends Jf_Controller_Plugin_Abstract {

    public function routeShutdown (Jf_Controller_Request_Abstract $request, Jf_Controller_Response_Abstract $response) {
        $dispatcher = Jf_Controller_Dispatcher::getInstance ();
        $module = $request -> getModuleName ();
        $bootstrapFile = $dispatcher -> getModulePath ($module) . '/Bootstrap.php';
        if ($module && file_exists ($bootstrapFile)) {
            require $bootstrapFile;
            $bootstrap = $module . '_Bootstrap';
            Jf_Bootstrap::bootstrap (new $bootstrap (), $dispatcher);
        }
        return $this;
    }

}
